package com.xzy.learn.spring.ioc.overview.config;

import com.xzy.learn.spring.entity.User;
import com.xzy.learn.spring.ioc.overview.repository.UserRepository;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.context.annotation.Bean;

import java.util.Collection;

/**
 * @author xzy.xiao
 * @date 2022/5/28  9:49
 */
public class DependencyInjectionDemoBeanConfig extends DependencyLookupDemoBeanConfig {

    @Bean
    public UserRepository userRepository1(Collection<User> users) {
        return new UserRepository(users);
    }

    @Bean
    public UserRepository userRepository2(Collection<User> users, ObjectFactory<User> userObjectFactory) {
        return new UserRepository(users, userObjectFactory);
    }

}
